
<CFQUERY NAME="qryGetDBLvl" DATASOURCE="#client.global_dsn#">
	SELECT TABLENAME,LEVELID FROM GRGBOSETABLE
	WHERE TABLENAME IN (''
	<CFIF sTables NEQ "">,#PreserveSingleQuotes(sTables)# </CFIF>)
</CFQUERY>
<CFSET sTbl = "">
<CFLOOP QUERY="qryGetDBLvl">
	<CFSET sTbl = sTbl & qryGetDBLvl.TABLENAME & "~" & qryGetDBLvl.LEVELID & ",">
</CFLOOP>
<CFLOOP QUERY="GetFormDetails">
	<CFSET nPos = ListContainsNoCase(sTbl,GetFormDetails.DETAILTABLE,",")>
	<CFIF nPos NEQ 0>
		<CFSET sTmp = ListGetAt(sTbl,nPos,",")>
		<CFSET client.sTmp = sTmp>
		<CFSET sLvl = ListGetAt(sTmp,2,"~")>
		<CFMODULE TEMPLATE="#client.common_path#cfm_leveldsn.cfm" DBLEVEL="#sLvl#">
		<CFQUERY NAME="qryDeleteInfocards" DATASOURCE="#DSN#">
			DELETE FROM #DETAILTABLE#
			WHERE
			<CFLOOP  INDEX="x" FROM="1" TO="5">
				<CFIF evaluate("GetFormDetails.LNK_FIELD" & x) NEQ "">
					<CFIF x NEQ "1">AND</CFIF>
					<CFSET theVal = evaluate("url." & evaluate("GetFormDetails.LNK_FIELD" & x))>
					(#ucase(evaluate("GetFormDetails.DTL_FIELD" & x))# = '#theVal#')
				</CFIF>
			</CFLOOP>
		</CFQUERY>
	</CFIF>
</CFLOOP>

